//
//  ServiceDetailsCell.swift
//  KaMengApplication
//
//  Created by DUONIU_MAC on 2018/11/26.
//  Copyright © 2018年 DUONIU_MAC. All rights reserved.
//

import UIKit

class ServiceDetailsCell: UITableViewCell {
    
    fileprivate let serviceImageView = UIImageView() //图片
    fileprivate let titleLabel = UILabel() //标题
    fileprivate let contextLabel = UILabel() //内容
    
    var serviceImage : String!{
        didSet{
            serviceImageView.image = UIImage.init(named: serviceImage)
        }
    }
    
    var title : String!{
        didSet{
            titleLabel.text = title
        }
    }
    
    var context : String!{
        didSet{
            contextLabel.text = context
        }
    }

    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        self.contentView.backgroundColor = UIColor.clear
        
        serviceImageView.contentMode = .scaleAspectFit
        self.contentView.addSubview(serviceImageView)
        
        titleLabel.font = UIFont.systemFont(ofSize: RATIO(maxNum: 18))
        self.contentView.addSubview(titleLabel)
        
        contextLabel.textColor = UIColor.lightGray
        contextLabel.font = UIFont.systemFont(ofSize: RATIO(maxNum: 16))
        self.contentView.addSubview(contextLabel)
        
        serviceImageView.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(RATIO_H(maxNum: 15))
            make.width.height.equalTo(RATIO_H(maxNum: 20))
            make.left.equalToSuperview().offset(RATIO(maxNum: 30))
        }
        
        titleLabel.snp.makeConstraints { (make) in
        make.left.equalTo(serviceImageView.snp.right).offset(RATIO(maxNum: 30))
            make.centerY.equalTo(serviceImageView)
            make.width.greaterThanOrEqualTo(10)
            make.height.equalTo(RATIO_H(maxNum: 30))
        }
        
        contextLabel.snp.makeConstraints { (make) in
            make.top.equalTo(titleLabel.snp.bottom)
            make.left.equalTo(titleLabel)
            make.width.greaterThanOrEqualTo(10)
            make.height.equalTo(RATIO_H(maxNum: 20))
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

    }

}
